<script>
export default {
  onLaunch: function() {
    console.log('App Launch');
    console.log('ppppp:', uni.getSystemInfoSync().platform);

    uni.setStorageSync('mdjk', 'https://api.auroth.vip');
    uni.setStorageSync('mdoss', 'http://modor.oss-cn-shanghai.aliyuncs.com/');

    var jkcs = { 'Content-Type': 'application/json' };
    var osscs = { token: `${uni.getStorageSync('access_token')}` };

    if (uni.getStorageSync('access_token')) {
      jkcs.token = uni.getStorageSync('access_token');
    }
    if (uni.getStorageSync('user').corpBaseInfoResponse) {
      jkcs.corp = uni.getStorageSync('user').corpBaseInfoResponse.id;
    }
    if (uni.getStorageSync('dqxm').id) {
      jkcs.project = uni.getStorageSync('dqxm').id;
    }

    uni.setStorageSync('jkcs', jkcs);
    uni.setStorageSync('osscs', osscs);

    //#ifdef APP-PLUS

    console.log('plus.runtime.appid:', plus.runtime.appid);

    console.log('plus.runtime.version:', plus.runtime.version);
    console.log('pterminal:', uni.getSystemInfoSync().platform);

    var server = `${uni.getStorageSync('mdjk')}/biz/app/version`; //检查更新地址
    var req = {
      //升级检测数据
      //   appId: plus.runtime.appid,
      version: plus.runtime.version,
      terminal: uni.getSystemInfoSync().platform,
    };

    uni.request({
      url: server,
      data: req,
      method: 'GET',
      header: uni.getStorageSync('jkcs'),

      success: openIdRes => {
        console.log('version11111:', openIdRes);
        if (
          openIdRes.data.success == true &&
          openIdRes.data.data.status === 1
        ) {
          uni.showModal({
            //提醒用户更新
            title: '更新提示',
            content: openIdRes.data.data.note,
            success: res => {
              if (res.confirm) {
                plus.runtime.openURL(openIdRes.data.data.url);
              }
            },
          });
        }
      },
    });

    //#endif
  },
  onShow: function() {
    console.log('App Show');

    // uni.setTabBarBadge({
    // 	index: 3,
    // 	text: ''
    // })

    uni.getSystemInfo({
      success: function(res) {
        uni.setStorageSync('xt', res);
        // console.log(uni.getStorageSync("xt").platform);
      },
    });

    global.isLogin = function() {
      try {
        var user_id = uni.getStorageSync('user').username;

        var access_token = uni.getStorageSync('access_token');
      } catch (e) {
        //TODO handle the exception
      }

      if (user_id == '' || access_token == '') {
        return false;
      } else {
        return [user_id, access_token];
      }
    };
  },
  onHide: function() {
    console.log('App Hide');
  },
};
</script>

<style>
/* 头条小程序需要把 iconfont 样式放到组件外 */
@import 'components/m-icon/m-icon.css';

/*每个页面公共css */
page {
  min-height: 100%;
  display: flex;
  font-size: 16px;
}

/* #ifdef MP-BAIDU */
page {
  width: 100%;
  height: 100%;
  display: block;
}

swan-template {
  width: 100%;
  min-height: 100%;
  display: flex;
}

/* 原生组件模式下需要注意组件外部样式 */
custom-component {
  width: 100%;
  min-height: 100%;
  display: flex;
}

/* #endif */

/* #ifdef MP-ALIPAY */
page {
  min-height: 100vh;
}

/* #endif */

/* 原生组件模式下需要注意组件外部样式 */
m-input {
  width: 100%;
  /* min-height: 100%; */
  display: flex;
  flex: 1;
}

.content {
  /* display: flex; */
  flex: 1;
  /* flex-direction: column; */
  background-color: #ffffff;
  padding: 0;
}

.input-group {
  background-color: #ffffff;
  margin-top: 20px;
  position: relative;
}

.input-group::before {
  /* position: absolute;
		right: 0;
		top: 0;
		left: 0;
		height: 1px;
		content: '';
		-webkit-transform: scaleY(.5);
		transform: scaleY(.5);
		background-color: #c8c7cc; */
}

.input-group::after {
  /* position: absolute;
		right: 0;
		bottom: 0;
		left: 0;
		height: 1px;
		content: '';
		-webkit-transform: scaleY(.5);
		transform: scaleY(.5);
		background-color: #c8c7cc; */
}

.input-row {
  display: flex;
  flex-direction: row;
  position: relative;
  font-size: 18px;
  line-height: 40px;
}

.input-row .title {
  width: 72px;
  padding-left: 15px;
}

.input-row.border::after {
  /* 	position: absolute;
		right: 0;
		bottom: 0;
		left: 8px;
		height: 1px;
		content: '';
		-webkit-transform: scaleY(.5);
		transform: scaleY(.5);
		background-color: #c8c7cc; */
}

.btn-row {
  /* 	margin-top: 25px;
		padding: 10px; */
}

button.primary {
  background-color: #0faeff;
}

.fix {
  *zoom: 1;
}

.fix:after {
  display: block;
  content: 'clear';
  height: 0;
  clear: both;
  overflow: hidden;
  visibility: hidden;
}

.clear {
  diplay: block !important;
  float: none !important;
  clear: both;
  overflow: hidden;
  width: auto !important;
  height: 0 !important;
  margin: 0 auto !important;
  padding: 0 !important;
  font-size: 0;
  line-height: 0;
}

.cell_bk {
  display: table;
  width: 100%;
  table-layout: fixed;
  word-wrap: break-all;
}

.ell {
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
}

.btn-row {
  width: 100%;
  height: auto;
  display: block;
  float: left;
}

.jlogin uni-button {
  width: 630rpx;
  height: 94rpx;
  display: block;
  float: left;
  margin: 10rpx 60rpx 0rpx;
  font-size: 36rpx;
  line-height: 94rpx;
  color: #ffffff;
  background: #256aff;
}

.jlogin uni-button:after {
  content: none;
}

.jlogin uni-button:active,
uni-button.buttom-hover {
  background: #256aff;
  color: #ffffff;
}

.jwj {
  width: 100%;
  height: auto;
  display: block;
  float: left;
  margin: 40rpx 0;
  text-align: center;
  font-size: 28rpx;
  color: #999999;
}

.navigator-hover {
  background: none;
  opacity: 1;
}

.noborder {
  border: none !important;
}

.hide {
  display: none !important;
}

.e-picker--text {
  width: 100%;
  height: auto;
  display: block;
  float: left;
}

.nomargin {
  margin: 0 !important;
}

.op5 {
  opacity: 0.5 !important;
}

.fr {
  float: right !important;
}

.status_bar {
  height: var(--status-bar-height);
  width: 100%;
  display: none;
  float: left;
}

.jfooter {
  width: 100%;
  height: 100rpx;
  display: block;
  float: left;
  position: fixed;
  z-index: 1000;
  background: #ffffff;
  border-top: 1px solid #dddddd;
  left: 0;
  bottom: 0;
}

.jfooter_b {
  width: 50%;
  height: 100rpx;
  display: block;
  float: left;
}

.jfooter_i {
  width: 50rpx;
  height: 50rpx;
  display: block;
  float: none;
  margin: 11rpx auto 5rpx;
}

.jfooter_t {
  width: 100%;
  height: 56rpx;
  display: block;
  float: none;
  font-size: 20rpx;
  line-height: 20rpx;
  text-align: center;
  color: #666666;
}

.active .jfooter_t {
  color: #256aff;
}

.footerhr {
  width: 100%;
  height: 88rpx;
  display: block;
  float: left;
}

.jfooter2 {
  width: 100%;
  height: 100rpx;
  display: block;
  float: left;
  position: fixed;
  z-index: 1000;
  background: #ffffff;
  border-top: 1px solid #dddddd;
  left: 0;
  bottom: 0;
}

.jfooter_b2 {
  width: 50%;
  height: 100rpx;
  display: block;
  float: left;
}

.jfooter_i2 {
  width: 50rpx;
  height: 50rpx;
  display: block;
  float: none;
  margin: 11rpx auto 5rpx;
}

.jfooter_t2 {
  width: 100%;
  height: 56rpx;
  display: block;
  float: none;
  font-size: 20rpx;
  line-height: 20rpx;
  text-align: center;
  color: #666666;
}

.active .jfooter_t2 {
  color: #256aff;
}
.mm .m-input-icon {
  margin-top: -40rpx;
}

.addi2 input {
  max-width: 480rpx;
}
.xx2:active {
  opacity: 0.9;
}
.uni-textarea-textarea,
textarea {
  color: #000;
}
</style>
